#pragma once

#include "MWCore.h"
#include "MWMath.h"

#include "MWRenderSystem.h"
#include "MWResourceManager.h"

namespace Myway
{

	class MW_ENTRY System
	{
		DECLARE_SINGLETON(System);

	public:
		System();
		~System();

		void Init(const char * resource = "resource.ini",
				  const char * log = "log.txt");
		void Shutdown();

		void SetRenderSystem(RenderSystem * pRenderSystem);

		void Run();

		float GetFrameTime();
		float GetTime();
		float GetFPS();

	protected:
		void ParseConfig(const char * sFileName);

	protected:
		ResourceManager *       mResourceManager;
		LogSystem *             mLogSystem;

		Timer					mTimer;
		float                   mLastFrameTime;
		float                   mFrameTime;
		float                   mLastFPSCalcTime;
		float                   mFPS;
	};

}